<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@taglib uri="/struts-tags" prefix="s" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>达内－NetCTOSS</title>
        <link type="text/css" rel="stylesheet" media="all" href="../styles/global.css" />
        <link type="text/css" rel="stylesheet" media="all" href="../styles/global_color.css" /> 
        <script language="javascript" type="text/javascript" src="../js/jquery-1.4.3.js"></script>
        <script language="javascript" type="text/javascript">
            //显示角色详细信息
            function showDetail(flag, a) {
                var detailDiv = a.parentNode.getElementsByTagName("div")[0];
                if (flag) {
                    detailDiv.style.display = "block";
                }
                else
                    detailDiv.style.display = "none";
            }
            //删除
            function deleteService(id) {
                var r = window.confirm("确定要删除此业务账号吗？删除后将不能恢复。");
                if(r){
                	$("."+id).fadeOut(1000);
                	$.post("deleteServiece",{"id":id},function(data){
                		if(data){
                			$("#operate_result_info").text("删除成功！").attr("style","display : block");
				        	setTimeout(function(){
								$("#operate_result_info").attr("style","display : none");
							},1000);                		
                		}else{
                			$("#operate_result_info").text("删除失败，请刷新后重试").attr("style","display : block");
                		}
                	});
                }
            }
            //开通或暂停
            function setState() {
                var r = window.confirm("确定要开通此业务账号吗？");
                document.getElementById("operate_result_info").style.display = "block";
            }
            //分页请求
            function toPage(currPage){
            	document.getElementById("currPage").value=currPage;
            	document.forms[0].submit();
            }
        </script>
    </head>
    <body>
        <!--Logo区域开始-->
        <div id="header">
            <img src="../images/logo.png" alt="logo" class="left"/>
            <a href="#">[退出]</a>            
        </div>
        <!--Logo区域结束-->
        <!--导航区域开始-->
        <div id="navi">                        
            <ul id="menu">
                <li><a href="../index/index" class="index_off"></a></li>
                <li><a href="../role/findRole" class="role_off"></a></li>
                <li><a href="../admin/findAdmin" class="admin_off"></a></li>
                <li><a href="../cost/findCost" class="fee_off"></a></li>
                <li><a href="../account/findAccount" class="account_off"></a></li>
                <li><a href="../service/findService" class="service_on"></a></li>
                <li><a href="../bill/findBill" class="bill_off"></a></li>
                <li><a href="../report/findReport" class="report_off"></a></li>
                <li><a href="../user/userInfo" class="information_off"></a></li>
                <li><a href="../user/userModiPwd" class="password_off"></a></li>
            </ul>            
        </div>
        <!--导航区域结束-->
        <!--主要区域开始-->
        <div id="main">
            <form action="" method="post">
            	<s:hidden name="page" id="currPage"></s:hidden>
                <!--查询-->
                <div class="search_add">                        
                    <div>OS 账号：
                    <s:textfield name="osUserName" cssClass="width100 text_search"></s:textfield>
                    </div>                        
                    <div>服务器 IP：
                    <s:textfield name="unixHost" cssClass="width100 text_search"></s:textfield>
                    </div>
                    <div>身份证：
                    <s:textfield name="idcardNo" cssClass="width100 text_search"></s:textfield>
                    </div>
                    <div>状态：
                    	<s:select name="status" list="#{'-1':'全部','0':'开通','1':'暂停','2':'删除'}" cssClass="select_search"></s:select>
                    </div>
                    <div><input type="submit" value="搜索" class="btn_search" /></div>
                    <input type="button" value="增加" class="btn_add" onclick="location.href='toAddService';" />
                </div>  
                <!--删除的操作提示-->
                <div id="operate_result_info" class="operate_success">
                    <img src="../images/close.png" onclick="this.parentNode.style.display='none';" />
                    删除成功！
                </div>   
                <!--数据区域：用表格展示数据-->     
                <div id="data">            
                    <table id="datalist">
                    <tr>
                        <th class="width50">业务ID</th>
                        <th class="width70">账务账号ID</th>
                        <th class="width150">身份证</th>
                        <th class="width70">姓名</th>
                        <th>OS 账号</th>
                        <th class="width50">状态</th>
                        <th class="width100">服务器 IP</th>
                        <th class="width100">资费</th>                                                        
                        <th class="width200"></th>
                    </tr>
                    <s:iterator value="services">
                    	<tr>
                    		<td><a href="#" title="查看明细"><s:property value="id"/></a></td>
                    		<td><s:property value="accountId"/></td>
                    		<td><s:property value="idcardNo"/></td>
                    		<td><s:property value="realName"/></td>
                    		<td><s:property value="osUserName"/></td>
                    		<td>
	                        	<s:if test="status==0">开通</s:if>
	                        	<s:elseif test="status==1">暂停</s:elseif>
	                        	<s:else>删除</s:else>
	                        </td>
                    		<td><s:property value="unixHost"/></td>
                    		<td><s:property value="costName"/></td>
                    		<td class="td_modi" >
	                        	<s:if test="status==0">
	                            <input type="button" value="暂停" class="btn_pause <s:property value="id"/>" onclick="pause(<s:property value="id"/>);" />
	                            <input type="button" value="修改" class="btn_modify <s:property value="id"/>" onclick="location.href='toUpdateService?id=<s:property value="id"/>'" />
	                            <input type="button" value="删除" class="btn_delete <s:property value="id"/>" onclick="deleteService(<s:property value="id"/>);" />
	                        	</s:if>
	                        	<s:elseif test="status==1">
	                        	<input type="button" value="开通" class="btn_start <s:property value="id"/>" onclick="start(<s:property value="id"/>);" />
	                            <input type="button" value="修改" class="btn_modify <s:property value="id"/>" onclick="location.href='toUpdateService?id=<s:property value="id"/>'" />
	                            <input type="button" value="删除" class="btn_delete <s:property value="id"/>" onclick="deleteService(<s:property value="id"/>);" />
	                        	</s:elseif>
	                        	<s:else></s:else>
	                        </td>
                    	</tr>
                    </s:iterator>
                </table>                
                <p>业务说明：<br />
                1、创建即开通，记载创建时间；<br />
                2、暂停后，记载暂停时间；<br />
                3、重新开通后，删除暂停时间；<br />
                4、删除后，记载删除时间，标示为删除，不能再开通、修改、删除；<br />
                5、业务账号不设计修改密码功能，由用户自服务功能实现；<br />
                6、暂停和删除状态的账务账号下属的业务账号不能被开通。</p>
                </div>                    
                <!--分页-->
                <div id="pages">
                	<a href="javascript:toPage(<s:property value='1'/>);">首页</a>
                	<s:if test="page==1">
                		<a href="#" >上一页</a>
                	</s:if>
                	<s:else>
                		<a href="javascript:toPage(<s:property value="page-1"/>);">上一页</a>
                	</s:else>
                    <s:iterator begin="1" end="totalPage" var="p">
                    	<s:if test="#p==page">
                    		<a href="javascript:toPage(<s:property/>);" class="current_page"><s:property/></a>
                    	</s:if>
                    	<s:else>
                    		<a href="javascript:toPage(<s:property/>);"><s:property/></a>
                    	</s:else>
                    </s:iterator>
                    
                    <s:if test="page==totalPage">
                    	<a href="#">下一页</a>
                    </s:if>
                    <s:else>
                    	<a href="javascript:toPage(<s:property value="page+1"/>);">下一页</a>
                    </s:else>
                    <a href="javascript:toPage(<s:property value="totalPage"/>);">末页</a>
                </div>                        
            </form>
        </div>
        <!--主要区域结束-->
        <div id="footer">
            <p>[源自北美的技术，最优秀的师资，最真实的企业环境，最适用的实战项目]</p>
            <p>版权所有(C)加拿大达内IT培训集团公司 </p>
        </div>
    </body>
</html>
